# -*- coding: utf-8 -*-
# @Time : 2019/1/10 14:37
# @Author : Administrator
# @File : bbb.py
# @Project : python
# @title : 接口测试 --- 登录
import HTMLTestRunner,requests,unittest,ddt
from WoniuBoss.Interface.tools.read_data import Read_Excel

data_li = Read_Excel()

host = "http://192.168.2.155:8080/WoniuBoss2.5"
@ddt.ddt
class Login(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        print("登录测试开始")
    @classmethod
    def tearDownClass(cls):
        print("登录测试完成")

    @ddt.data(*data_li.excel(r"E:\41\python\WoniuBoss\Interface\data\test_data.xlsx",1))
    def test_login_001(self,data):
        response = requests.request("POST",host+"/log/userLogin",
                                  data = {"userName":data["userName"],"userPass":data["userPass"],"checkcode":data["checkcode"]})
        actual = response.text
        assert data["expect"] in actual
        # print(actual)


if __name__ == '__main__':
    unittest.main()
    # suite = unittest.TestSuite()
    # from WoniuBoss.Interface.case import login
    # suite.addTests(unittest.TestLoader().loadTestsFromModule(login))
    # with open("../report/woniuboss2.5测试报告.html","w",encoding="utf-8") as f:
    #     runner = HTMLTestRunner.HTMLTestRunner(f)
    #     runner.run(suite)